<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1" />
		<title>欢迎使用恒旗录单管理系统</title>
		<link rel="stylesheet" href="resource/css/layui.css" />
		<link rel="stylesheet" type="text/css" href="css/normalize.css" />
		<link rel="stylesheet" type="text/css" href="css/demo.css" />
		<!--必要样式-->
		<link rel="stylesheet" type="text/css" href="css/component.css" />
		<!--[if IE]>
		<script src="js/html5.js"></script>
		<![endif]-->
	</head>
	<body>
		<div class="container demo-1" >
			<div class="content" >
				<div id="large-header" class="large-header" >
					<canvas id="demo-canvas"></canvas>
					<div class="logo_box" >
						<h3>注册</h3>
						<form class="layui-form" action="" name="f" style="overflow-y:auto; overflow-x:auto; width:400px; height:400px;">
						    <input name="usState" class="text" style="color: #FFFFFF !important" type="text" value="3" style="display:none;">
							<div class="input_outer">
								<span class="u_user"></span>
								<input name="usPhone" required lay-verify="phone" class="text" style="color: #FFFFFF !important" type="text" placeholder="请输入用户手机号">
							</div>
							<div class="input_outer">
								<span class="u_user"></span>
								<input name="usName" required lay-verify="required" class="text" style="color: #FFFFFF !important" type="text" placeholder="请输入用户姓名">
							</div>
							<div class="input_outer">
								<span class="u_user"></span>
								<input name="usIdNumbe" required lay-verify="identity" class="text" style="color: #FFFFFF !important" type="text" placeholder="请输入用户身份证号">
							</div>
							
							<div class="input_outer">
								<span class="u_user"></span>
								<select name="usChannel" required lay-verify="required" class="text" style="color: #FFFFFF !important">
									<option value="2" th:each="role : ${list}" 
								th:selected="*{usChannel}==${role.id}?'selected'"
								 th:value="${role.id}"
								 th:text="${role.chName}">请选择</option>
	     					    </select>
							</div>
							<div class="input_outer">
								<span class="u_user"></span>
								<input name="usHomeAddres" required lay-verify="required" class="text" style="color: #FFFFFF !important" type="text" placeholder="请输入家庭住址">
							</div>
							<div class="input_outer">
								<span class="us_uer"></span>
								<input name="usPassword" required lay-verify="required" class="text" style="color: #FFFFFF !important; position:absolute; z-index:100;"value="" type="password" placeholder="请输入密码">
							</div>
							<div class="input_outer">
								<span class="us_uer"></span>
								<input name="usPassword2" required lay-verify="required" class="text" style="color: #FFFFFF !important; position:absolute; z-index:100;"value="" type="password" placeholder="请输入重复密码">
							</div>
							<div class="mb2"><a class="act-but submit" lay-submit lay-filter="formSubmit" href="javascript:;" style="color: #FFFFFF">注册</a></div>
						</form>
					</div>
				</div>
			</div>
		</div><!-- /container -->
		<script src="js/TweenLite.min.js"></script>
		<script src="js/EasePack.min.js"></script>
		<script src="js/rAF.js"></script>
		<script src="js/demo-1.js"></script>
		<script src="resource/layui.js"></script>
		
		<script type="text/javascript" th:inline="javascript">
			layui.use(['form','jquery'],function(){
				//判断是否在frame中，在则整体刷新
				if (self != top) { 
					top.location.reload();
				}
				var form = layui.form;
				var $ = layui.$;
				form.on("submit(formSubmit)",function(data){
					var a_re=data.field;
					var a_re_a=a_re.usPhone;
					var a_re_b=a_re.usPassword;
					var a_re_c=a_re.usPassword2;
					var a_re_d=a_re.usName;
					var regName =/^[\u4e00-\u9fa5]{2,4}$/;
					if(!regName.test(a_re_d)){
					  layer.msg("真实姓名填写有误", {icon: 5});
					  return false;
					}
					var reg = /^[0-9a-zA-Z]+$/;
					if(!reg.test(a_re_b)){
						 layer.msg("密码不是数字或者字母", {icon: 5});
						 return false;
						}
					if(a_re_b!=a_re_c){
						layer.msg("重复密码不一致", {icon: 5});
						return false;
					}
					var valid_rule = /^(13[0-9]|14[5-9]|15[012356789]|166|17[0-8]|18[0-9]|19[8-9])[0-9]{8}$/;// 手机号码校验规则
					
					$.ajax({
						url : "auser/ainesrt",
						data : data.field,
						async : false,
						success : function(res) {
							console.log(res);
							if (res.success) {
								layer.msg('加载中', {
									icon : 16,
									shade : 0.01
								});
								window.location = "./a_login";
// 							if([[${url}]]){
// 									window.location = "."+[[${url}]];
// 								}else{
// 									window.location = "./";
// 								}
							} else {
								layer.msg(res.msg);
							} 
						},
						error : function(result) {
	
						}
					});
					return false;
				})
			});
		</script>
	</body>
</html>
